<script setup lang="ts">
import {reactive, ref} from 'vue'

const dialogFormVisible = ref(false)
const formLabelWidth = '140px'

const form = reactive({
  address: '',
  time: '',
  server:''
})

const initAndShow = () => {
  dialogFormVisible.value = true
}
defineExpose({
  initAndShow,
})
</script>

<template>
  <el-dialog v-model="dialogFormVisible" title="提交家政服务订单">
    <el-form :model="form">
      <el-form-item label="下单地址" :label-width="formLabelWidth" prop="name">
        <el-input v-model="form.address" autocomplete="off"/>
      </el-form-item>
      <el-form-item label="预定时间" :label-width="formLabelWidth">
        <el-date-picker
            :v-model= form.time
            type="date"
            placeholder="挑选日期"
        />
      </el-form-item>
      <el-form-item label="预定服务" :label-width="formLabelWidth">
        <el-select v-model="form.server" placeholder="填写服务类型">
          <el-option label="维修" value="type1"/>
          <el-option label="清洁" value="type2"/>
          <el-option label="搬家" value="type3"/>
        </el-select>
      </el-form-item>
    </el-form>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取消</el-button>
        <el-button type="primary" @click="dialogFormVisible = false">
          提交
        </el-button>
      </span>
    </template>
  </el-dialog>
</template>

<style scoped>
.el-button--text {
  margin-right: 15px;
}

.el-select {
  width: 300px;
}

.el-input {
  width: 300px;
}

.dialog-footer button:first-child {
  margin-right: 10px;
}
</style>